package com.hd.trans.widgets.views

import android.content.Context
import android.util.AttributeSet

class SquareImageView(context: Context, attrs: AttributeSet?) : androidx.appcompat.widget.AppCompatImageView(context, attrs) {

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)
        // 判断方式一
        // val side = min(widthMeasureSpec, heightMeasureSpec)
        // setMeasuredDimension(side, side)
        // 判断方法二
        setMeasuredDimension(widthMeasureSpec, widthMeasureSpec)
    }
}